import * as AgentApi from '@/api/call/agent'
import { usePhoneStore } from '@/store/modules/phone'
import { formatDate } from '@/utils/formatTime'
import mobileWebSocket from '@/utils/mobileWebSocket'
import { ElMessage } from 'element-plus'
/**
 * SIM卡 外呼 sdk
 * 1. 使用ws连接到服务端
 * 2. 调用call API 外呼
 */

export function useSimPhone() {
  const useStore = usePhoneStore()

  const reg = async () => {
    const { status } = mobileWebSocket.websocketObj
    console.info('SIM REG: ===', status)
    if (status == 'OPEN') {
      ElMessage.success('SIM卡模式已激活')
    }
    // 连接上的话直接登录
    useStore.setAgentStatus('login')
  }
  const call = async (params) => {
    // 先去请求call接口 > 暴漏给useCall中默认实现
    // const data = await AgentApi.simpleCall(params)
  }
  return {
    reg,
    call
  }
}
